﻿// -----------------------------------------------------------------------
// <copyright file="ActionBase.cs" company="Microsoft">
// TODO: Update copyright text.
// </copyright>
// -----------------------------------------------------------------------

namespace Eeeek
{
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Xml.Serialization;

    /// <summary>
    /// Properties common to batch and triggered jobs
    /// </summary>
    public class ActionBase
    {
        /// <summary>
        /// Gets or sets the batch number.
        /// </summary>
        /// <value>
        /// The batch number.
        /// </value>
        public int Number { get; set; }

        /// <summary>
        /// Gets or sets the time stamp.
        /// </summary>
        /// <value>
        /// The time stamp.
        /// </value>
        public DateTime TimeStamp { get; set; }

        /// <summary>
        /// Gets or sets the clicks.
        /// </summary>
        /// <value>
        /// The clicks.
        /// </value>
        public List<MainFormDataGridRow> Clicks { get; set; }

        /// <summary>
        /// Gets the clicks as a binding list of type MainFormDataGridRow.
        /// </summary>
        [XmlIgnore]
        public BindingList<MainFormDataGridRow> ClicksAsBindingList
        {
            get
            {
                var result = new BindingList<MainFormDataGridRow>();
                foreach (var mainFormDataGridRow in this.Clicks)
                {
                    result.Add(mainFormDataGridRow);
                }

                return result;
            }
        }
    }
}
